-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User Management Navigator Supervisor Backend Implementation #120
Conversation
4755dc1
to
6021eea
Compare
Things are looking great! Few comments.. |
6021eea
to
92b460a
Compare
done! |
92b460a
to
1472961
Compare
Sorry just double checking, once the pending revocation has been approved by the admin the status should say "revoked" in the Nav supervisor view. "Approved" for new user approval. |
1472961
to
20989b3
Compare
yes, that's correct |
678ac54
to
b255a96
Compare
app/src/db/models/access_request.ts
Outdated
|
||
import type { Stamps } from '../stamps'; | ||
import type { AccessRequest } from '../../types/AccessRequest'; // Import the access_request_status_enum type | ||
import { UserStatus } from '../../utils/enums/application'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import ordering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for catching
app/src/services/user.ts
Outdated
|
||
const trxWrapper = (etrx: Prisma.TransactionClient | undefined = undefined) => (etrx ? etrx : prisma); | ||
|
||
// Constants | ||
const SYSTEM_USER = 'system'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SYSTEM_USER
should be checked by it's guid, which is NIL, not name.
const SYSTEM_USER = NIL;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
app/src/types/User.ts
Outdated
@@ -10,4 +12,5 @@ export type User = { | |||
fullName: string | null; | |||
lastName: string | null; | |||
active: boolean; | |||
accessRequest?: AccessRequest | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User and AccessRequest are different concepts. It doesn't feel right that they are combined like this.
app/src/services/user.ts
Outdated
* @returns {Promise<object>} The result of running the insert operation | ||
* @throws The error encountered upon db transaction failure | ||
*/ | ||
createUserAccessRequest: async (data: User) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per lower comment, user and AccessRequest are different concepts. Function should take two different parameters.
app/src/services/user.ts
Outdated
/** | ||
* @function listNavigators | ||
* Lists all the | ||
* @param {boolean} [active] Optional boolean on user active status | ||
* @returns {Promise<object>} The result of running the find operation | ||
*/ | ||
getNavsAndAccessRequests: async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSDoc needs to be fixed. And function name isn't accurate as it's not limited to just the Navs. getLatestAccessRequests
is more appropriate.
app/src/services/user.ts
Outdated
/** | ||
* @function revokeUserAccessRequest | ||
* Updates user access | ||
* @returns {Promise<object>} The result of running the put operation | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect JSDoc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for catching
app/src/services/user.ts
Outdated
* @returns {Promise<object>} The result of running the put operation | ||
*/ | ||
updateUserRole: async (user: User) => { | ||
console.log(user); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove console log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just put it there to stop unused 'user' variable complaints. I've removed it!
app/src/utils/enums/application.ts
Outdated
@@ -30,6 +30,11 @@ export enum Initiative { | |||
HOUSING = 'HOUSING' | |||
} | |||
|
|||
export enum UserStatus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misnomer. This is the status of the access request, not the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
app/src/utils/enums/application.ts
Outdated
} | ||
export enum Regex { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: Please ensure new lines are between blocks. I've noticed this a few times within this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
094a6cc
to
2c4df1f
Compare
2c4df1f
to
5b617b0
Compare
6296b20
to
11b21df
Compare
response = await service.createUser(data, trx); | ||
}); | ||
return user.fromPrismaModel(response); | ||
} else return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transaction not required at this level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
bae93d4
to
cb78639
Compare
Comment on the sorting of the "status" column. |
0899735
to
771576a
Compare
771576a
to
1b74a32
Compare
As discussed went with PR, PA & A. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed semantically. Lots of file changes, difficult to follow the full logic. Functionality looks to be there.
Description
PADS-222
User Management - Supervisor backend implementation
features - create new user, revoke user, manage user (will be functional after rbac)
migration added for access_request table
Types of changes
New feature (non-breaking change which adds functionality)
Checklist
Further comments